<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>我的</title>
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link href="{RES}css/style.css" rel="stylesheet" type="text/css">
    <link href="{RES}css/mob.css" rel="stylesheet" type="text/css">
    <script src="{RES}js/jquery.min.js" type="text/javascript"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
	<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">


	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body id="message" >
<div class="qiandaobanner">
    <a href="javascript:history.go(-1);"><img src="{$imgurl}" ></a>
</div>
<!-- 判断是否有审核 -->

{if $admin != $uid}
<div class="history">
    <div class="history-date">
        {loop $data $item}
        <div class="panel panel-success" style="margin-bottom:3px;">
            <div class="panel-heading col-xs-12 col-sm-12" style="padding:10px 1px;">
      	        <div class="col-xs-8 col-sm-8 " style="padding-left:6px;">
                    发表于：{php echo date('Y-m-d H:i', $item['dateline'])}
                </div>
                <div class="col-xs-4 col-sm-4">
                    状态:{if $item['status'] == 1}<span style="color:#66CD00;">已审核</span>{else}<span style='color:#FF0000;'>未审核</span>{/if}
                </div>
            </div>
            <div class="panel-body" style="padding:2px 15px;">
                <div class="" style="margin-top:6px;">
                    <div class="mcontent">{$item['content']}</div>
                </div>
            </div>
        </div>
        {/loop}
    </div>
</div>
{else}
<div class="history">
    <div class="history-date">
        <div class="beizhu">管理员只显示未审核留言</div>
        <form action="" method="post" class="form-horizontal form">
        {loop $unpass $item}
        <div class="panel panel-success" style="margin-bottom:3px;">
            <div class="panel-heading col-xs-12 col-sm-12" style="padding:3px 0px;">
                <div class="col-xs-2 col-sm-2"><input type="radio" name="check" value="{$item['id']}"></div>
                <div class="col-xs-10 col-sm-10 " >
                    用户名：{$item['username']}
                </div>
            </div>
            <div class="panel-body" style="padding:2px 15px;">
                <div class="" style="margin-top:6px;">
                    <div class="mcontent">{$item['content']}</div>
                </div>
            </div>
        </div>
        {/loop}
        <!-- <div class="col-xs-4 col-sm-4">
            <input type="checkbox" class="check_all"  />全选
        </div> -->

        <input type="submit" class="btn btn-primary btn-lg col-xs-6 col-sm-6 pull-right" name="checkall" value="点击审核">
        </form>
    </div>
</div>
{/if}

<div style="width:100%;height:30px;margin-bottom:70px;"></div>
{if $admin != $uid}
<style>
    .footer {position: fixed;bottom: 0;background-color:white;height:50px;width:100%;text-align: center;border-top:1px solid #eee;font-size:14px;padding:2px 0 0 0;}
</style>
<div class="footer" style="z-index: 9999">
    <ul id="dian">
        <a class="footerlink" href="{php echo $this->createMobileUrl('Index',array('action'=>''))}" >
            <li class="footerli" >
                <img src="{RES}images/index.png" ><br>
                <span>首页</span>
            </li>
        </a>
        <a class="footerlink" data-toggle="modal" data-target="#myModal">
            <li class="footerli" >
                <img src="{RES}images/message.png" ><br>
                <span>留言</span>
            </li>
        </a>
        <!-- Modal -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel">留言板</h4>
                    </div>
                    <div class="modal-body">
                            <div class="input-group">
                                <span class="input-group-addon" id="basic-addon1">昵称：</span>
                                <input type="text" class="form-control" placeholder="用户名" id="wxname1" name="wxname" aria-describedby="basic-addon1" value="{$nickname}">
                            </div>
                            <div class="form-group">
                                <label for="name">内容：</label>
                                <textarea name="info" id="info1" class="form-control" rows="5" placeholder="请输入内容，少于300字。"></textarea>
                            </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button class="btn btn-primary" id="showcard1">提交</button>
                    </div>
                </div>
            </div>
        </div>
        <a class="footerlink" href="{php echo $this->createMobileUrl('User')}" >
            <li class="footerli" >
                <img src="{RES}images/owner.png" ><br>
                <span>我的</span>
            </li>
        </a>
    </ul>
</div>
{/if}
<script type="text/javascript">
    $(document).ready(function () {
        var ActionUrl = "{php echo $this->createMobileUrl('sendreply', array(), true);}";
        $("#showcard1").bind('click',function () {
            var btn = $(this);
            btn.unbind('click');
            var wxname = $("#wxname1").val();
            if (wxname  == '') {
                alert("请输入昵称");
                return
            }
            var info = $("#info1").val();
            if (info == '') {
                alert("请输入内容1");
                return
            }
            var submitData = {
                from_user:"{$from_user}",
                username:wxname,
                content: info,
                type: "feedback"
            };
            $.post(ActionUrl, submitData,function(data) {
                if (data.status == 1) {
                    alert(data.message);
                    setTimeout('window.location.href=location.href',1000);
                    return;
                } else {
                    alert(data.message);
                }
            },"json")
        });


        $("#showcard2").bind('click',function(){
            var btn = $(this);
            var wxname = $("#wxname2").val();
            if (wxname  == '') {
                alert("请输入昵称");
                return
            }
            var info = $("#info2").val();
            if (info == '') {
                alert("请输入内容");
                return
            }
            var submitData = {
                from_user:"{$from_user}",
                username: wxname,
                content: info,
                type: "feedback"
            };
            $.post(ActionUrl, submitData,function(data) {
                if (data.status == 1) {
                    alert(data.message);
                    setTimeout('window.location.href=location.href',1000);
                    return;
                } else {
                    alert(data.message);
                }
            },"json")
        });

        $(".hhsubmit").bind('click',function(){
            $(this).unbind('click');
            var objid = $(this).attr("date");
            var info = $(".hly"+objid).val();
            if (info == '') {
                alert("请输入内容");
                return
            }
            var submitData = {
                from_user:"{$from_user}",
                username:'',
                parentid:objid,
                content: info,
                type: "reply"
            };

            $.post(ActionUrl, submitData,function(data) {
                //alert(data.message);
                if (data.status == 1) {
                    alert(data.message);
                    setTimeout('window.location.href=location.href',1000);
                    return;
                } else {
                    alert(data.message);
                }
            },"json")
        });

        $(".hfinfo").click(function(){
            var objid = $(this).attr("date");
            $(".hhly"+objid).slideToggle();
        });
        $(".hhbt").click(function(){
            var objid = $(this).attr("date");
            $(".hhly"+objid).slideToggle();
        });

        var ipage = parseInt($('.ipage').text());
        var cpage = parseInt($('.cpage').text());
        if(ipage>=cpage && cpage <=1){
            $('.right').attr('class','right disabled');
            $('.left').attr('class','left disabled');
            $('.right a').attr('href','###');
            $('.left a').attr('href','###');
        }else if(ipage<=1 && cpage>1){
            $('.left').attr('class','left disabled');
            $('.left a').attr('href','###');
        }else if(ipage ==cpage && cpage >1){
            $('.right').attr('class','right disabled');
            $('.right a').attr('href','###');
        }
    });
    $("#windowclosebutton").click(function(){
        $("#windowcenter").slideUp(500);
    });
    $("#alertclose").click(function(){
        $("#windowcenter").slideUp(500);
    });

    function alert(title){
        $("#windowcenter").slideToggle("slow");
        $("#txt").html(title);
        setTimeout('$("#windowcenter").slideUp(500)',4000);
    }
    $(document).ready(function(){
        $(".first1").click(function(){
            $(".ly1").slideToggle();
        });
    });
    $(document).ready(function(){
        $(".first2").click(function(){
            $(".ly2").slideToggle();
        });
    });
</script>

</body>
</html>